package com.wqtz.chechai.view.activities;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.wqtz.chechai.R;
import com.wqtz.chechai.base.BaseActivity;
import com.wqtz.chechai.presenter.BasePresent;
import com.wqtz.chechai.utils.SPUtils;
import com.wqtz.chechai.utils.ToastUtils;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import me.nereo.multi_image_selector.MultiImageSelectorActivity;

/**
 * 项目名称： CheChai
 * 创建人 :  Kisum
 * 创建时间: 2017/2/6
 * 续约资料页面
 */
public class RenewInfomationActivity extends BaseActivity {
    @BindView(R.id.iv_back)
    ImageView mIvBack;
    @BindView(R.id.rl_contract_info)
    RelativeLayout mRlContractInfo;
    @BindView(R.id.rl_contract_info2)
    RelativeLayout mRlContractInfo2;
    @BindView(R.id.rl_contract_info3)
    RelativeLayout mRlContractInfo3;
    private final int REQUEST_IMAGE = 2010;//获取续约资料图片
    private ArrayList<String> renewImages; //续约图片本地地址集合

    @Override
    public void init() {
        ButterKnife.bind(this);

    }

    @Override
    public void loadData() {

    }

    @Override
    public int setContentViews() {
        return R.layout.activity_renew_info;
    }

    @Override
    public BasePresent createPresenter() {
        return null;
    }

    @OnClick({R.id.iv_back,R.id.rl_contract_info,R.id.rl_contract_info2,R.id.rl_contract_info3})
    public void onClick(View view) {
        switch (view.getId()) {
            //返回
            case R.id.iv_back:
                this.finish();
                break;
            //续约资料15天
            case R.id.rl_contract_info:
                Intent toUpLoadRenewInfoIntent = new Intent(this,UpLoadRenewalInfoActivity.class);
                startActivity(toUpLoadRenewInfoIntent);
                break;
            //续约资料15天
            case R.id.rl_contract_info2:
                Intent toUpLoadRenewInfoIntent2 = new Intent(this,UpLoadRenewalInfoActivity.class);
                startActivity(toUpLoadRenewInfoIntent2);
                break;
            //续约资料15天
            case R.id.rl_contract_info3:
                Intent toUpLoadRenewInfoIntent3 = new Intent(this,UpLoadRenewalInfoActivity.class);
                startActivity(toUpLoadRenewInfoIntent3);
                break;
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK) {
            switch (requestCode) {
                case REQUEST_IMAGE: {
                    // Get the result list of select image paths
                    renewImages.addAll(data.getStringArrayListExtra(MultiImageSelectorActivity.EXTRA_RESULT));
                    SPUtils.put(this, "renewImages", renewImages);
                    ToastUtils.show(this, renewImages.get(0), 2000);
                }
                break;
            }
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        activitys.add(this); //添加当前的activity
    }
}
